package com.example.pingapplication2.viewModel;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 最大连续失败次数界面的viewModel
 */
public class MaxFailViewModel extends ViewModel {
    public MutableLiveData<Integer> totalFailure = new MutableLiveData<>(1);//最大连续失败次数
    public MutableLiveData<Boolean> set = new MutableLiveData<>(false);//最大连续失败次数是否设置
    public MutableLiveData<Integer> curTime = new MutableLiveData<>(0);//当前时间
    public MutableLiveData<Boolean> start = new MutableLiveData<>(false);//是否开始测试
    public MutableLiveData<Integer> curFailure = new MutableLiveData<>(0);//当前连续失败次数

    public Timer maxFailPingTimer;
    public TimerTask maxFailPingTimerTask;

    public Timer maxFailRunTimer;
    public TimerTask maxFailRunTimerTask;

    public synchronized void calCurTime(){
        int time = curTime.getValue();
        time++;
        curTime.postValue(time);
    }
}
